<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="xml在线格式化,xml在线格式化, html在线格式化,js代码格式化">
    <meta name="description" content="可以对xml进行格式化排版，整齐的进行显示。">
    <meta name="author" content="">

    <title>XML格式化</title>
    <link rel="shortcut icon" href="favicon.png" type="image/x-icon">
    <!-- Bootstrap Core CSS -->
    <link href="static/v2.0/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- MetisMenu CSS -->
    <link href="static/v2.0/bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
    <!-- Timeline CSS -->
    <!-- <link href="static/v2.0/dist/css/timeline.css" rel="stylesheet"> -->
    <!-- Custom CSS -->
    <link href="static/v2.0/dist/css/sb-admin-2.css" rel="stylesheet">
    <!-- Morris Charts CSS -->
    <!-- <link href="static/v2.0/bower_components/morrisjs/morris.css" rel="stylesheet"> -->
    <!-- Custom Fonts -->
    <link href="static/v2.0/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

    <div id="wrapper">
        <div id="page-wrapper">
            <div style="height: 10px;"></div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            XML格式化、压缩
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">

                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="form-group">
                                        <label>XML</label>
                                        <textarea class="form-control data" rows="25"></textarea>
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-lg-12">
                                    <button type="button" class="btn btn-outline btn-primary pretty">美化</button>
                                    &nbsp;&nbsp;
                                    <button type="button" class="btn btn-outline btn-primary minimize">压缩</button>
                                    &nbsp;&nbsp;
                                    <button type="button" class="btn btn-outline btn-primary eg">给个例子</button>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>



            <div style="height: 10px;"></div>


        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="static/v2.0/bower_components/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="static/v2.0/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="static/js/lib/jquery.format.js"></script>
    <script type="text/javascript">
        (function () {


            (function () {
                return false;
                var menu = [],
                    local_menu = [];

                function add_new(link) {
                    var o = $(".topnav li a[href='" + link + "']");
                    var text = o.html();
                    var f = "<font class='newf' style='color:red;'>•</font>";
                    o.html(text + f);

                    var p = o.parents('ul').siblings('a.dropdown-toggle');
                    if (p) {
                        if (p.find(".newf").length == 0) {
                            var text = p.html();
                            p.html(text + f);
                        }
                    }
                };
                $(".topnav li a").each(function () {
                    menu.push($(this).attr('href'));
                })
                    .on('click', function () {
                        local_menu.push($(this).attr('href'));
                        localStorage.local_menu = local_menu.toString();
                    });

                if (localStorage.local_menu == undefined) {
                    localStorage.local_menu = menu.toString();
                } else {
                    local_menu = localStorage.local_menu.split(',');
                    // find diff
                    for (var i in menu) {
                        var isnew = true;
                        for (var j in local_menu) {
                            if (menu[i] == local_menu[j]) {
                                isnew = false;
                                continue;
                            }
                        }
                        if (isnew) {
                            // 加红点
                            add_new(menu[i]);
                        }
                    }
                }
            })()





        })()
    </script>




    <script type="text/javascript">
            (function () {
                $(".pretty").on('click', function () {
                    $(".data").format({
                        method: 'xml'
                    });
                });
                $(".minimize").on('click', function () {
                    $(".data").format({
                        method: 'xmlmin'
                    });
                });
                $(".eg").on('click', function () {
                    var xml = '%3C%3Fxml%20version%3D%221.0%22%3F%3E%3Cnote%3E%3Cto%3EGeorge%3C%2Fto%3E%3Cfrom%3EJohn%3C%2Ffrom%3E%3Cheading%3EReminder%3C%2Fheading%3E%3Cbody%3Ewww.kjson.com%3C%2Fbody%3E%3C%2Fnote%3E';
                    $(".data").val(decodeURIComponent(xml));
                });
            })()
    </script>
</body>

</html>